package me.stone.stanimeclient.core.model

import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.NightMode

enum class DarkThemeMode(val storageKey: String, @NightMode val modeValue: Int) {
    Light("light", AppCompatDelegate.MODE_NIGHT_NO),
    Dark("dark", AppCompatDelegate.MODE_NIGHT_YES),
    System("system", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);

    companion object {
        @JvmStatic
        fun find(storageKey: String?): DarkThemeMode {
            return storageKey?.let { key ->
                entries.firstOrNull { it.storageKey == key }
            } ?: System
        }
    }
}